package com.h3c.nem.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * 新员工关怀类型
 *
 * @author z22968
 * @date 2022/6/9 11:45
 */
@Getter
@AllArgsConstructor
public enum CareInfoType {

    SOCIAL_SHORT(0, "社招短周期"),
    SOCIAL_LONG(1, "社招长周期"),
    SCHOOL(2, "校招"),
    SCHOOL_OTHER(3, "校招其他"),
    EXCELLENT_PERFORMANCE(4, "绩效优秀"),
    USER(5, "用户");

    @EnumValue
    private final Integer code;

    //    @JsonValue
    private final String name;

//
//    private static final Map<Integer, RelationType> CODE_MAP = Stream
//            .of(RelationType.values())
//            .collect(Collectors.toMap(RelationType::getCode, Function.identity()));
//
//
//    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
//    public static RelationType valueOfKey(Integer key) {
//        return Optional.ofNullable(CODE_MAP.get(key))
//                .orElseThrow(() -> new IllegalArgumentException(String.valueOf(key)));
//    }
}
